package com.cykj.pos.service.impl;

import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.commons.lang3.StringUtils;
import com.cykj.pos.mapper.ToolCashbackTemplateMapper;
import com.cykj.pos.domain.ToolCashbackTemplate;
import com.cykj.pos.service.IToolCashbackTemplateService;

import java.util.List;
import java.util.Map;

/**
 * 机具返现模板Service业务层处理
 *
 * @author weijianbo
 * @date 2025-01-20
 */
@Service
public class ToolCashbackTemplateServiceImpl extends ServiceImpl<ToolCashbackTemplateMapper, ToolCashbackTemplate> implements IToolCashbackTemplateService {

    @Override
    public List<ToolCashbackTemplate> queryList(ToolCashbackTemplate toolCashbackTemplate) {
        LambdaQueryWrapper<ToolCashbackTemplate> lqw = Wrappers.lambdaQuery();
        if (toolCashbackTemplate.getActiveAmount() != null){
            lqw.eq(ToolCashbackTemplate::getActiveAmount ,toolCashbackTemplate.getActiveAmount());
        }
        if (toolCashbackTemplate.getActiveExpireTime() != null){
            lqw.eq(ToolCashbackTemplate::getActiveExpireTime ,toolCashbackTemplate.getActiveExpireTime());
        }
        if (toolCashbackTemplate.getBogusActiveAmount() != null){
            lqw.eq(ToolCashbackTemplate::getBogusActiveAmount ,toolCashbackTemplate.getBogusActiveAmount());
        }
        if (toolCashbackTemplate.getBogusActiveExamineDays() != null){
            lqw.eq(ToolCashbackTemplate::getBogusActiveExamineDays ,toolCashbackTemplate.getBogusActiveExamineDays());
        }
        if (toolCashbackTemplate.getBogusActiveAccumulateAmount() != null){
            lqw.eq(ToolCashbackTemplate::getBogusActiveAccumulateAmount ,toolCashbackTemplate.getBogusActiveAccumulateAmount());
        }
        if (toolCashbackTemplate.getBogusActiveDeduction() != null){
            lqw.eq(ToolCashbackTemplate::getBogusActiveDeduction ,toolCashbackTemplate.getBogusActiveDeduction());
        }
        if (toolCashbackTemplate.getNotActiveDeduction() != null){
            lqw.eq(ToolCashbackTemplate::getNotActiveDeduction ,toolCashbackTemplate.getNotActiveDeduction());
        }
        if (toolCashbackTemplate.getStandardAmount() != null){
            lqw.eq(ToolCashbackTemplate::getStandardAmount ,toolCashbackTemplate.getStandardAmount());
        }
        if (toolCashbackTemplate.getStandardExpireDays() != null){
            lqw.eq(ToolCashbackTemplate::getStandardExpireDays ,toolCashbackTemplate.getStandardExpireDays());
        }
        if (StringUtils.isNotBlank(toolCashbackTemplate.getCircularCashback())){
            lqw.eq(ToolCashbackTemplate::getCircularCashback ,toolCashbackTemplate.getCircularCashback());
        }
        if (StringUtils.isNotBlank(toolCashbackTemplate.getVar1())){
            lqw.eq(ToolCashbackTemplate::getVar1 ,toolCashbackTemplate.getVar1());
        }
        return this.list(lqw);
    }
}
